<%--
    Document   : verRegistroLogs
    Created on : 04/05/2009, 20:00:01
    Author     : root
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.*"%>
<%@page import="java.net.*"%>
<%@page import="java.io.BufferedReader"%>
<%@page import="java.io.File"%>
<%@page import="java.io.FileReader"%>

<html>
    <head>
        <link href="estilos.css" rel="stylesheet" type="text/css">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Registro de logs</title>
    </head>
    <body>
        <%
            // Comprobamos si existe usuario en la sesion
            if (session.getAttribute("login") != null && ((String) session.getAttribute("login")).length() > 0)
            {
                File f = new File("/tmp/proyecto_debug.log");
                FileReader fr = new FileReader(f);
                BufferedReader br = new BufferedReader(fr);

                StringBuffer sb = new StringBuffer();
                String eachLine = br.readLine();

                while (eachLine != null) {
                  sb.append(eachLine);
                  sb.append("\n");
                  eachLine = br.readLine();
                }
                String contenido= sb.toString();
            %>

            <fieldset>
            <legend>Registro de logs</legend>
            <table width="600" border="1" id="tablaOpciones" >
             <tbody>
              <tr>
                  <td> <img src="images/log4.jpg" align="right"> </td>
              </tr>
              <tr>
                  <td> <textarea rows="30" cols="90" readonly> <%=contenido%> </textarea> </td>
              </tr>
              <td> <a class="user" href="gestionAplicacion.jsp"> Volver </a> </td>
             </tbody>
            </table>
            </fieldset>
            <%
            }
            else
            {
            %><META HTTP-EQUIV="REFRESH" CONTENT="1;URL=error.jsp">
            <%
            }
        %>
    </body>
</html>
